package org.example.Controller;


import lombok.extern.slf4j.Slf4j;
import org.example.Exception.StudentNoExistException;
import org.example.Pojo.Emp;
import org.example.Pojo.LoginInfo;
import org.example.Pojo.Result;
import org.example.Server.EmpServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class LoginController {


    @Autowired
    private EmpServer empServer;

    @PostMapping("/login")
    public Result login(@RequestBody Emp emp) throws StudentNoExistException {
        log.info("登录");
        LoginInfo loginInfo = empServer.selectByUserNameAndPassword(emp);
        return Result.success(loginInfo);
    }
}
